<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        // 创建连接
        const xhr = new XMLHttpRequest() ;
        // 打开通讯录
        xhr.open('get' , '../data/goods.json' , true) ;
        // 打电话
        xhr.send() ;
        // 等待
        xhr.onreadystatechange = function() {
            if(xhr.readyState === 4 && xhr.status === 200) {
                // 获取数据的内容
                let data = xhr.responseText ;
                console.log(data);
                
            }
        }

    </script>
    
</body>
</html>